﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using System.IO;
using BLL;
using Table_Dal;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace ApplicationLayer.Obj_frmCaNhan
{
    public partial class frmExportCauHoi : DevComponents.DotNetBar.OfficeForm
    {
        string Ma;
        public frmExportCauHoi(string p)
        {
            
            Ma = p;
            InitializeComponent();
            CauHoiBll chbll = new CauHoiBll();
            List<CauHoiTbl> lstCauhoi = chbll.DSCauHoiDeThi(Ma);
            List<CauHoiTbl> lstCauhoi1 = new List<CauHoiTbl>();
            int i = 0;
            string[] arr = { "A", "B", "C", "D", "E", "F" };
            int daa = 0;
            DapAnBll da = new DapAnBll();
            DethiBLL dt = new DethiBLL();
            DeThiTbl dthi = dt.ThongTinDeTHi_Madethi(Ma);
            lstCauhoi1.Add(new CauHoiTbl("\n\tTRƯỜNG ĐAI HỌC CÔNG NGHIỆP TP HCM \t\t\t\t\tĐỀ: " + dthi.TENDETHI+"\n\t                  BỘ CÔNG THƯƠNG             \t\t\t\t\t\tTHỜI GIAN : " +(dthi.THOIGIAN).ToString()+" phút"));
            foreach (CauHoiTbl ch in lstCauhoi)
            {
                daa = 0;
                lstCauhoi1.Add(new CauHoiTbl("\nCâu " + ++i + ": " + ch.NoiDung));
                List<DapAnTbl> dsda = da.DapAnCauHoi_TheoMacauHoi_TenCauHoi(ch.MaCauHoi, "");
                foreach (DapAnTbl item in dsda)
                {
                    lstCauhoi1.Add(new CauHoiTbl("\t\t" + arr[daa++] + ". " + item.NoiDung));
                }
            }
            rptDeThi inde = new rptDeThi();

            CrypviewDeThi.ReportSource = inde;
            inde.SetDataSource(lstCauhoi1);
            
            
        }

        private void checkBoxX7_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void checkBoxX6_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }

        private void frmExportCauHoi_Load(object sender, EventArgs e)
        {



           
        }
        
    }
}